package com.example.jdai.jdai.util;

import android.content.Context;
import android.content.SharedPreferences;

import com.example.jdai.jdai.MyApplication;
import com.example.jdai.jdai.config.Config;

import java.util.HashMap;

/**
 * Created by hellopyj on 2017/1/11.
 */

public class DataConnect extends BaseData{
    public static String CONNECT="connect";
    //public static int STATUS;
    public static String CT_TO=CONNECT+"_to";
    //public static String CT_TO_INDEX=CONNECT+"_to_index";
    public static String CT_TO_TEL=CONNECT+"_to_tel";
    public static String CT_OTHER=CONNECT+"_other";
    //public static String CT_OTHER_INDEX=CONNECT+"_other_INDEX";
    public static String CT_OTHER_TEL=CONNECT+"_other_tel";
    //public HashMap<String,String> data=new HashMap<>();
    public static String CT_STATUS=CONNECT+"_status";

    public DataConnect()
    {
        count=5;
        SharedPreferences sp= MyApplication.applicationContext.getSharedPreferences(Config.SP_NAME, Context.CONTEXT_RESTRICTED);
        data.put(CT_TO,sp.getString(CT_TO,""));
        //data.put(CT_TO_INDEX,sp.getString(CT_TO_INDEX,"0"));
        data.put(CT_TO_TEL,sp.getString(CT_TO_TEL,""));
        data.put(CT_OTHER,sp.getString(CT_OTHER,""));
        //data.put(CT_OTHER_INDEX,sp.getString(CT_OTHER_INDEX,"0"));
        data.put(CT_OTHER_TEL,sp.getString(CT_OTHER_TEL,""));
        data.put(CT_STATUS,sp.getString(CT_STATUS,""));

    }
    public boolean saveAll()
    {
        super.saveAll();
        return dataCheck();
    }


//public boolean dataCheck() {
//    boolean check=super.dataCheck();
//    if(check)
//        MyApplication.dataAll.data.put(DataAll.CONNECT_STATUS,DataAll.SHENGCHA+"");
//    else
//        MyApplication.dataAll.data.put(DataAll.CONNECT_STATUS,DataAll.SHENGCHA_WWC+"");
//    return check;
//
//}
}
